package com.hqyj.service.impl;

import com.hqyj.dao.classifyDao;
import com.hqyj.service.classifyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class classifyServiceImpl implements classifyService {

    @Autowired
    private classifyDao classifyDao;


    @Override
    public Map<String, List> ClassifyTypeMap() {

        HashMap<String, List> TypeMap = new HashMap<>();
        List<String> Typelist = classifyDao.querytype();

        for(String one:Typelist){
            List<String> modelList = classifyDao.querymodlebytype(one);
            TypeMap.put(one,modelList);
        }

        return TypeMap;
    }

    @Override
    public List ClassifyType() {
        List<String> typeList = classifyDao.querytype();
        return typeList;
    }

    @Override
    public List<String> ClassifymodelBytype(String type) {
        List<String> modelList = classifyDao.querymodlebytype(type);

        return modelList;
    }

    @Override
    public List<String> ClassifyBrandbymodel(String model) {
        List<String> strings = classifyDao.querybrandByModel(model);

        return strings;
    }


}
